<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class Customer extends Authenticatable
{
    use Notifiable;

    public function orders(){
        return $this->hasMany(Order::class);
    }

    public function bookings(){
        return $this->hasMany(Booking::class);
    }

    public function comments(){
        return $this->hasManyThrough(Comment::class, Booking::class);
    }

    /* TODO: get all payments of a user
    public function payments(){
    }
    */

    protected $fillable = [
        'name', 'email', 'password', 'gender', 'phone',
    ];

    protected $hidden = [
        'password', 'remember_token',
    ];

    protected $casts = [
        'email_verified_at' => 'datetime',
    ];
}
